/*
 *
 * *******************************************************************
 *   @项目名称: BHex Android
 *   @文件名称: FileUtils.java
 *   @Date: 11/29/18 3:21 PM
 *   @Author: chenjun
 *   @Copyright（C）: 2018 BlueHelix Inc.   All rights reserved.
 *   注意：本内容仅限于内部传阅，禁止外泄以及用于其他的商业目的.
 *  *******************************************************************
 *
 */

package io.bhex.baselib.utils;

import android.os.Environment;


public class FileUtils {

    /**
     * SD卡是否可用
     */
    public static boolean isExternalStorageMounted() {
        try {
            boolean canRead = Environment.getExternalStorageDirectory().canRead();
            boolean onlyRead = Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED_READ_ONLY);
            boolean unMounted = Environment.getExternalStorageState().equals(Environment.MEDIA_UNMOUNTED);
            return ! ( ! canRead || onlyRead || unMounted);
        } catch (Exception e) {
            return false;
        }
    }


}
